﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;

namespace Splittergame
{
    class SplitterSystem
    {
        private SplitterParticle[] SplitterArray;
        private const int MAX_PARTICLES = 100;
        private Vector2 m_StartPosition;
        private Texture2D sparkTexture;

        public SplitterSystem(Vector2 startPosition) 
        {
            m_StartPosition = startPosition;

        }
        internal void LoadContent(ContentManager content)
        {           
            //TODO: FLYTTA TEXTUR TILL VIEW

            sparkTexture = content.Load<Texture2D>("spark");
            SplitterArray = new SplitterParticle[MAX_PARTICLES];

            for (int i = 0; i < MAX_PARTICLES; i++)
            {
                SplitterArray[i] = new SplitterParticle(i, sparkTexture, m_StartPosition);
            }
      
        }

        public void Update(GameTime elapsedTime)
        {
            foreach (SplitterParticle Splitter in SplitterArray)
            {
                Splitter.Update(elapsedTime);                
            }

        }
        internal void Draw(SpriteBatch spriteBatch, Camera camera)
        {
            foreach (SplitterParticle Splitter in SplitterArray)
            {
                Splitter.Draw(spriteBatch, camera);
            }
        }

    }
}
